"use client";

import AuthModal from "@/components/AuthModal";
import UploadModal from "@/components/UploadModal";
import { useEffect, useState } from "react";

const ModalProvider = () => {
  const [ isMounted, setIsMounted ] = useState(false);

  //服务器渲染下的水合作用，防止该Modal组件引起的错误操作
  //确保在客户端下组件的正常渲染
  useEffect(() => {
    setIsMounted(true);
  }, []);
  if(!isMounted) return null;

  return (
    <>
      <AuthModal/>
      <UploadModal/>
    </>
  );
}

export default ModalProvider;